package androidgame.teslawars;

import androidgame.framework.Music;
import androidgame.framework.Sound;
import androidgame.framework.gl.Font;
import androidgame.framework.gl.Texture;
import androidgame.framework.gl.TextureRegion;
import androidgame.framework.impl.GLGame;

// This class will hold all the textures/sounds/etc. required for the game for easy reference.
// See the Texture, TextureRegion, Sound, and Music file for descriptions of how to use the constructors.
// @author dicarlo2

public class Assets {
    public static Texture background;
    public static TextureRegion backgroundRegion;
        
    public static Texture items;
    public static TextureRegion dialog; // When a unit is selected, this dialog is displayed with the appropriate text
    public static TextureRegion player1Tank;
    public static TextureRegion player2Tank;
    public static TextureRegion player1Soldier;
    public static TextureRegion player2Soldier;
    public static TextureRegion player1Jet;
    public static TextureRegion player2Jet;
    public static TextureRegion highlight;
    
    public static TextureRegion twoTrees;
    public static TextureRegion oneTree;
    public static TextureRegion crossroads;
    public static TextureRegion horizontalRoad;
    public static TextureRegion horizontalRiver;
    public static TextureRegion lake1;
    public static TextureRegion lake2;
    public static TextureRegion lake3;
    public static TextureRegion lake4;
    public static TextureRegion lake5;
    public static TextureRegion twoRocks;
    public static TextureRegion grass1;
    public static TextureRegion grass2;
    public static TextureRegion rightAngleRoad;
    public static TextureRegion rightAngleRiver;
    public static TextureRegion threeWayRiver;
    public static TextureRegion threeWayRoad;
    public static TextureRegion mountain;
    
    public static Font teslaWarsFont;
    public static Font readableFont;
    
    public static Sound hit;
    public static Music backgroundMusic;
    
    
	
	public static void load(GLGame game){
        background = new Texture(game, "map1.png");
        backgroundRegion = new TextureRegion(background, 0, 0, 320, 320);
        
        items = new Texture(game, "items.png");      
        
        lake4 = new TextureRegion(items, 260, 2, 32, 32);
        oneTree = new TextureRegion(items, 294, 2, 32, 32);
        lake5 = new TextureRegion(items, 328, 2, 32, 32);
        twoRocks = new TextureRegion(items, 362, 2, 32, 32);
        twoTrees = new TextureRegion(items, 396, 2, 32, 32);
        rightAngleRiver = new TextureRegion(items, 430, 2, 32, 32);
        rightAngleRoad = new TextureRegion(items, 464, 2, 32, 32);
        
        lake3 = new TextureRegion(items, 260, 36, 32, 32);
        crossroads = new TextureRegion(items, 294, 36, 32, 32);
        grass2 = new TextureRegion(items, 328, 36, 32, 32);
        threeWayRiver = new TextureRegion(items, 362, 36, 32, 32);
        threeWayRoad = new TextureRegion(items, 396, 36, 32, 32);
        grass1 = new TextureRegion(items, 430, 36, 32, 32);
        lake1 = new TextureRegion(items, 464, 36, 32, 32);
        
        lake2 = new TextureRegion(items, 260, 70, 32, 32);
        horizontalRiver = new TextureRegion(items, 294, 70, 32, 32);
        horizontalRoad = new TextureRegion(items, 328, 70, 32, 32);
        highlight = new TextureRegion(items, 362, 70, 32, 32);
        mountain = new TextureRegion(items, 396, 70, 32, 32);
        
        player1Jet = new TextureRegion(items, 267, 103, 64, 64);
        player1Soldier = new TextureRegion(items, 333, 103, 64, 64);
        player1Tank = new TextureRegion(items, 399, 103, 64, 64);
        
        dialog = new TextureRegion(items, 267, 169, 64, 64);
        player2Jet = new TextureRegion(items, 333, 169, 64, 64);
        player2Soldier = new TextureRegion(items, 399, 169, 64, 64);
        
        player2Tank = new TextureRegion(items, 267, 234, 64, 64);
        
        teslaWarsFont = new Font(items, 1, 1, 8, 32, 30);
        readableFont = new Font(items, 1, 260, 14, 18, 24);
        
        
	}
	
	public static void reload(){
        background.reload();
        items.reload();
        if(Settings.soundEnabled)
            backgroundMusic.play();
	}
	
    public static void playSound(Sound sound) {
        if(Settings.soundEnabled)
            sound.play(1);
    }
}
